package creationPattern.Factory;

import creationPattern.Factory.Factory_01.controller.DeliverController;
import creationPattern.Factory.Factory_01.entity.AwardInfo;
import creationPattern.Factory.Factory_01.entity.SmallGiftInfo;
import org.junit.jupiter.api.Test;

import java.util.HashMap;

public class Factory_Test_01 {
    @Test
    public void test_01(){
        // 1、发放打折券
        DeliverController deliverController = new DeliverController();

        AwardInfo awardInfo = new AwardInfo();
        awardInfo.setAwardType(1);
        awardInfo.setuId("allwe");
        awardInfo.setAwardNumber("product_001");

        deliverController.awardToUser(awardInfo);
    }

    @Test
    public void test_02(){
        // 2、发放优酷会员
        DeliverController deliverController = new DeliverController();

        AwardInfo awardInfo = new AwardInfo();
        awardInfo.setAwardType(2);
        awardInfo.setAwardNumber("product_002");
        HashMap<String,String> map = new HashMap<>();
        map.put("phone","13191576923");
        awardInfo.setExtMap(map);

        deliverController.awardToUser(awardInfo);
    }

    @Test
    public void test_03(){
        // 3、发放小礼品
        DeliverController deliverController = new DeliverController();

        AwardInfo awardInfo = new AwardInfo();
        HashMap<String,String> map = new HashMap<>();
        map.put("phone","13191576923");
        map.put("address","北京 - 海淀");
        map.put("userName","allwe");
        awardInfo.setAwardType(3);
        awardInfo.setExtMap(map);

        deliverController.awardToUser(awardInfo);
    }
}
